#!/bin/sh
#
# cyphesis          This shell script takes care of starting and stopping
#                   the cyphesis service.
#
# chkconfig: - 99 01
# description: Cyphesis is a server for WorldForge online games.
# probe: ???

if [ -f /etc/rc.d/init.d/functions ] ; then
        . /etc/rc.d/init.d/functions
fi

# Source cyphesis service configuration
if [ -f /etc/sysconfig/cyphesis ] ; then
        . /etc/sysconfig/cyphesis
else
        CYPHESISUSER=cyphesis
fi

start() {
        # Run the client

        # /var/lock/subsys/cyphesis
        echo -n $"Populating cyphesis world: "

        # Run the server, in self daemonising mode
        su $CYPHESISUSER -c "/usr/bin/cyclient" >/dev/null 2>&1
        RETVAL=$?
        if [ $RETVAL -eq 0 ]; then
            echo_success
        else
            echo_failure
        fi
        echo
        return $RETVAL
}

stop() {
        return 0
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  *)
        echo $"Usage: $0 (start|stop)"
        exit 1
esac

exit $RETVAL
